home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / regicon / reginf5.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-12-11  |  8.6 KB  |  244 lines

  1. VERSION 5.00
  2. Object = "{6B1BE80A-567F-11D1-B652-0060976C699F}#1.0#0"; "Regicon.ocx"
  3. Begin VB.Form Form1 
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Regicon Browser Settings"
  6.    ClientHeight    =   1935
  7.    ClientLeft      =   1500
  8.    ClientTop       =   3585
  9.    ClientWidth     =   8895
  10.    Icon            =   "reginf5.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    PaletteMode     =   1  'UseZOrder
  14.    ScaleHeight     =   1935
  15.    ScaleWidth      =   8895
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.CommandButton cmdSteps 
  18.       Caption         =   "&See the Code"
  19.       Height          =   375
  20.       Left            =   7320
  21.       TabIndex        =   2
  22.       Top             =   600
  23.       Width           =   1455
  24.    End
  25.    Begin VB.CommandButton cmdClose 
  26.       Caption         =   "&Close"
  27.       Height          =   375
  28.       Left            =   7320
  29.       TabIndex        =   1
  30.       Top             =   240
  31.       Width           =   1455
  32.    End
  33.    Begin VB.Frame Frame1 
  34.       Height          =   1695
  35.       Left            =   120
  36.       TabIndex        =   0
  37.       Top             =   120
  38.       Width           =   6975
  39.       Begin VB.CommandButton cmdReset 
  40.          Caption         =   "&Reset Start Page"
  41.          Height          =   375
  42.          Left            =   5160
  43.          TabIndex        =   10
  44.          Top             =   1200
  45.          Width           =   1695
  46.       End
  47.       Begin VB.CommandButton cmdApply 
  48.          Caption         =   "&Change Start Page"
  49.          Height          =   375
  50.          Left            =   5160
  51.          TabIndex        =   9
  52.          Top             =   840
  53.          Width           =   1695
  54.       End
  55.       Begin VB.ComboBox cboStartPages 
  56.          Height          =   315
  57.          Left            =   1680
  58.          TabIndex        =   3
  59.          Top             =   840
  60.          Width           =   3375
  61.       End
  62.       Begin RegistryControl.RegiCon RegiCon1 
  63.          Left            =   120
  64.          Top             =   840
  65.          _ExtentX        =   847
  66.          _ExtentY        =   847
  67.       End
  68.       Begin VB.Label lblDefaultBrowser 
  69.          Height          =   255
  70.          Left            =   1680
  71.          TabIndex        =   8
  72.          Top             =   240
  73.          Width           =   3375
  74.       End
  75.       Begin VB.Label Label2 
  76.          Alignment       =   1  'Right Justify
  77.          Caption         =   "Deafult Browser:"
  78.          Height          =   255
  79.          Left            =   120
  80.          TabIndex        =   7
  81.          Top             =   240
  82.          Width           =   1455
  83.       End
  84.       Begin VB.Label Label3 
  85.          Alignment       =   1  'Right Justify
  86.          Caption         =   "Current Start Page:"
  87.          Height          =   255
  88.          Left            =   120
  89.          TabIndex        =   6
  90.          Top             =   480
  91.          Width           =   1455
  92.       End
  93.       Begin VB.Label lblStartPage 
  94.          Height          =   255
  95.          Left            =   1680
  96.          TabIndex        =   5
  97.          Top             =   480
  98.          Width           =   3375
  99.       End
  100.       Begin VB.Label Label1 
  101.          Alignment       =   1  'Right Justify
  102.          Caption         =   "Start Pages:"
  103.          Height          =   255
  104.          Left            =   600
  105.          TabIndex        =   4
  106.          Top             =   840
  107.          Width           =   975
  108.       End
  109.    End
  110. Attribute VB_Name = "Form1"
  111. Attribute VB_GlobalNameSpace = False
  112. Attribute VB_Creatable = False
  113. Attribute VB_PredeclaredId = True
  114. Attribute VB_Exposed = False
  115. Private DefaultBrowser As String
  116. Private DefaultStartPage As String
  117. Private NewStartPage As String
  118. Private fDirty As Boolean
  119. Private Sub cmdApply_Click()
  120.     Dim i As Integer
  121.     Dim fMatch As Boolean
  122.     If MsgBox("Change start page from " & vbCrLf & NewStartPage & vbCrLf & "to" & vbCrLf & cboStartPages.Text & "?", vbQuestion + vbYesNo, "Confirm Change?") = vbNo Then
  123.         Exit Sub
  124.     End If
  125.     NewStartPage = cboStartPages.Text
  126.     fDirty = True
  127.     If InStr(1, lblDefaultBrowser.Caption, "IExplore", 1) > 0 Then
  128.         'IE
  129.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  130.         RegiCon1.Key = "Software\Microsoft\Internet Explorer\Main"
  131.         RegiCon1.KeyItemName = "Start Page"
  132.         RegiCon1.KeyItemType = dtREG_SZ
  133.         RegiCon1.KeyItemValue = NewStartPage
  134.         RegiCon1.SetEntry
  135.     ElseIf InStr(1, lblDefaultBrowser.Caption, "Netscape", 1) > 0 Then
  136.         'Netscape
  137.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  138.         RegiCon1.Key = "Software\Netscape\Netscape Navigator\Main"
  139.         RegiCon1.KeyItemName = "Home Page"
  140.         RegiCon1.KeyItemType = dtREG_SZ
  141.         RegiCon1.KeyItemValue = NewStartPage
  142.         RegiCon1.SetEntry
  143.     End If
  144.     lblStartPage.Caption = NewStartPage
  145.     For i = 0 To cboStartPages.ListCount - 1
  146.         If StrComp(NewStartPage, cboStartPages.List(i), 1) = 0 Then
  147.             fMatch = True
  148.             Exit For
  149.         End If
  150.     Next i
  151.     If fMatch = False Then
  152.         cboStartPages.AddItem NewStartPage, 0
  153.     End If
  154. End Sub
  155. Private Sub cmdClose_Click()
  156.     Unload Me
  157. End Sub
  158. Private Sub cmdReset_Click()
  159.     If InStr(1, lblDefaultBrowser.Caption, "IExplore", 1) > 0 Then
  160.         'IE
  161.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  162.         RegiCon1.Key = "Software\Microsoft\Internet Explorer\Main"
  163.         RegiCon1.KeyItemName = "Start Page"
  164.         RegiCon1.KeyItemType = dtREG_SZ
  165.         RegiCon1.KeyItemValue = DefaultStartPage
  166.         RegiCon1.SetEntry
  167.     ElseIf InStr(1, lblDefaultBrowser.Caption, "Netscape", 1) > 0 Then
  168.         'Netscape
  169.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  170.         RegiCon1.Key = "Software\Netscape\Netscape Navigator\Main"
  171.         RegiCon1.KeyItemName = "Home Page"
  172.         RegiCon1.KeyItemType = dtREG_SZ
  173.         RegiCon1.KeyItemValue = DefaultStartPage
  174.         RegiCon1.SetEntry
  175.     End If
  176.     lblStartPage.Caption = DefaultStartPage
  177.     cboStartPages.ListIndex = 0
  178.     NewStartPage = DefaultStartPage
  179.     fDirty = False
  180. End Sub
  181. Private Sub cmdSteps_Click()
  182.     frmCode.Show 1
  183. End Sub
  184. Private Sub Form_Load()
  185.     'verify there is a default browser entry
  186.     RegiCon1.RootKey = rkHKEY_LOCAL_MACHINE
  187.     RegiCon1.Key = "SOFTWARE\Classes\http\shell\open\ddeexec\Application"
  188.     RegiCon1.KeyItemName = ""
  189.     If RegiCon1.IsEntry = False Then
  190.         '
  191.         'no default browser installed, disable change start page options
  192.         cboStartPages.Enabled = False
  193.         cmdApply.Enabled = False
  194.         cmdReset.Enabled = False
  195.         Exit Sub
  196.     End If
  197.     'get the default browser
  198.     RegiCon1.GetEntry
  199.     '
  200.     'Display the entry
  201.     lblDefaultBrowser.Caption = RegiCon1.KeyItemValue
  202.     If InStr(1, lblDefaultBrowser.Caption, "IExplore", 1) > 0 Then
  203.         'Default is Internet Explorer
  204.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  205.         RegiCon1.Key = "Software\Microsoft\Internet Explorer\Main"
  206.         RegiCon1.KeyItemName = "Start Page"
  207.         RegiCon1.GetEntry
  208.         DefaultStartPage = RegiCon1.KeyItemValue
  209.     ElseIf InStr(1, lblDefaultBrowser.Caption, "Netscape", 1) > 0 Then
  210.         'Default is Netscape
  211.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  212.         RegiCon1.Key = "Software\Netscape\Netscape Navigator\Main"
  213.         RegiCon1.KeyItemName = "Home Page"
  214.         RegiCon1.GetEntry
  215.         DefaultStartPage = RegiCon1.KeyItemValue
  216.     Else
  217.         'unknown default browser, disable change start page options
  218.         cboStartPages.Enabled = False
  219.         cmdApply.Enabled = False
  220.         cmdReset.Enabled = False
  221.         Exit Sub
  222.     End If
  223.     '
  224.     'load the StartPage box with a list of URLs
  225.     NewStartPage = DefaultStartPage
  226.     lblStartPage.Caption = NewStartPage
  227.     cboStartPages.AddItem NewStartPage
  228.     cboStartPages.AddItem "http://www.mabry.com/index.htm"
  229.     cboStartPages.AddItem "http://www.microsoft.com/index.htm"
  230.     cboStartPages.AddItem "http://www.netscape.com/index.html"
  231.     cboStartPages.ListIndex = 0
  232. End Sub
  233. Private Sub Form_Unload(Cancel As Integer)
  234.     '
  235.     'if we've ended up with something different than
  236.     'we started with, see if the user wants to keep
  237.     'the new setting
  238.     If StrComp(NewStartPage, DefaultStartPage, 1) <> 0 Then
  239.         If MsgBox("The start page has changed from " & vbCrLf & DefaultStartPage & vbCrLf & "to" & vbCrLf & NewStartPage & vbCr & vbCrLf & "Keep this new start page?", vbQuestion + vbYesNo, "Confirm Change?") = vbNo Then
  240.             cmdReset_Click
  241.         End If
  242.     End If
  243. End Sub
  244.